﻿/**
 * 特殊符号
 */
(function(E, $){
var Consts = E.consts,
	charTable = [
		['±','×','÷','∶','∑','∏','∪','∩','∈','∷'],
		['√','⊥','∥','∠','⌒','∫','∮','≡','≌','≈'],
		['∝','≠','≮','≯','≤','≥','∞','∵','∴','㏑'],
		['㏒'],
		['＄','￠','￡','㏎','㎎','㎏','㎜','㎝','㎞','㎡'],
		['㏄','㏕','№'],
		['ā','á','ǎ','à','ē','é','ě','è','ī','í'],
		['ǐ','ì','ō','ó','ǒ','ò','ū','ú','ǔ','ù'],
		['ǖ','ǘ','ǚ','ǜ','ü']
	];

E.plugin("SpecialChar", {
	isNeedTitle:0,
	config : {
		width : 280
	},
	style : '.jqe-plugin-SpecialChar td{width:25px;height:25px;}\
			ul.jqe-plugin-SpecialChar {margin:0; padding:0;}\
			.jqe-plugin-SpecialChar .special_num{background-color:#EEEEEE;border:1px solid #EEEEEE;cursor:pointer;height:20px;width:20px;line-height:20px;color:#000;display:block;text-align:center;}\
			.jqe-plugin-SpecialChar a.special_num:hover{background-color:#ECF1F7;border:1px solid #AECFF7;}',
	init : function() {
		var html = '<ul class="jqe-plugin-SpecialChar"><table>';
			for(var i = 0; i < charTable.length ; i++) {
				var item = charTable[i];
				html+= '<tr>';
				for(var j= 0; j< item.length; j++) {
					html+= '<td><a href="javascript:void(0)" class="special_num">'+item[j]+'</a></td>';
				}
				html+= '</tr>';
			}
			html+='</table></ul>';
		this.cache['html'] = html;
	},
	action : function( target, panel, self ) {
		var tdObj = target.closest('.jqe-plugin-SpecialChar td');
		if(tdObj.length){
			self.pasteHTML( tdObj.text() );
			self.hide();
		}
		return false;
	}
});

})(jQEditor, jQuery);